<?php
class Inspection extends AppModel {
	var $name = 'Inspection';
	var $displayField = 'name';
	//The Associations below have been created with all possible keys, those that are not needed can be removed

	var $belongsTo = array(
		'Item' => array(
			'className' => 'Item',
			'foreignKey' => 'item_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		),
		'Status' => array(
			'className' => 'Status',
			'foreignKey' => 'status_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		)
	);
	
	function afterFind($results) {
		foreach ($results as $key => $val) {
			if (isset($val['Inspection']['date'])) {
				$results[$key]['Inspection']['date'] = $this->dateFormatAfterFind($val['Inspection']['date']);
		
			}
	
		}
	
		return $results;
	}

	function dateFormatAfterFind($dateString) {
		return date('d-M-Y', strtotime($dateString));
		}
}
